package com.primus.server.service;

import com.primus.server.entity.BaseEntity;
import com.primus.server.exception.ApplicationException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface BaseService<T extends BaseEntity> {

    List<T> findAll();

    Page<T> findAllWithPagination(Pageable pageable);

    T findById(Long id) throws ApplicationException;

    T save(T t);

    void delete(BaseEntity entity);

    void deleteAll(Iterable<T> entities);

    void deleteById(Long id);

    T upsert(T newEntity, Long id);

    void saveAll(List<T> list);

}
